
<?php

@session_start();

//header("Content-type:text/html;charset=utf-8");

require(dirname(__FILE__) . "/../lib/common.inc");

$s_aid = '';
$username = '';
$s_val = '';

if (!isset($_POST['id'])) {
	$s_aid = '';
} else {
	$s_aid = $_POST['id'];
}

if (!isset($_POST['val'])) {
	$s_val = '';
} else {
	$s_val = $_POST['val'];
	if ($s_val == '支持') {
		$s_val = 'support';
	}
	if ($s_val == '反对') {
		$s_val = 'oppose';
	}
}

if(!isset($_SESSION['username'])){
	$username = '';
} else {
	$username = $_SESSION['username'];
}

$errno = 0;$s_errno = '0';
if (trim($s_aid) == "") $errno = -1;
if ($errno < 0) {
	$s_errno = strval($errno);
	echo("{\"errno\":\"{$s_errno}\"}");
	exit();
}

$errno = add_attitue_article($s_aid, $username, $s_val);
$s_errno = strval($errno);
echo("{\"errno\":\"{$s_errno}\"}");

?>
